<div id="ddmenu">
<ul class="sf-menu">
	<?php
	// Get configuration settings
	$config = find_plugin_settings('treecategories');
	$cats = json_decode($config->treecategories, true);
	$menu = $cats['categories']['main'];
	foreach($menu as $key => $option) {
		echo "<li class=\"".$option['class']."\"><a href=\"".$vars['url']."mod/treecategories/category.php?category=".$key."\">".$option['value']."</a>\n<ul>";
		foreach($option['sub'] as $subKey => $cat) {
			$optionValue = $key.$subKey;
      echo "<li><a href=\"".$vars['url']."mod/treecategories/category.php?category=".$optionValue."\">".$cat['value']."</a></li>\n";
		}
		echo "</ul></li>";
  }
	?>
</ul>
</div>